﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AlmaDatabase;

namespace Alma.Models
{
    public class CategoryModel
    {
        public long ID { get; set;}
        public long? ID_Realm { get; set; }
        public string Name_Realm { get; set; }
        public string Name { get; set; }
        public int? Location { get; set; }
        public string ImageName { get; set; }

        public CategoryModel(Category category)
        {
            ID = category.ID;
            ID_Realm = category.ID_Realm;
            Name = category.Name;
            Location = category.Location;
            ImageName = category.ImageName;
            using (var entities = new AlmaDBEntities())
            {
                foreach (var realm in (from p in entities.Realms where ID_Realm == p.ID select p))
                {
                    Name_Realm = realm.Name;
                }
            }
        }

        public CategoryModel()
        {
            // TODO: Complete member initialization
        }
    }

    public class CategoriesModel
    {
        public List<Category> Categories;
    }

   

    public class CategoriesModelList
    {
        public List<CategoryModel> categoriesList;
    }
}